home *** CD-ROM | disk | FTP | other *** search
Text File | 2011-10-17 | 31.7 KB | 1,107 lines |
- class classes.bro.Bro2
- {
- var tX;
- var x;
- var tY;
- var y;
- var clip;
- var w;
- var h;
- var weapon;
- var trans;
- var colorTrans;
- var colorVars;
- var baseSpeed;
- var speed;
- var fireDir;
- var dc;
- var fireFreq;
- var fireFreqOrig;
- var shotX;
- var shotY;
- var dirX;
- var dirY;
- var destX;
- var destY;
- var xyMetFunction;
- var dirXArray;
- var dirYArray;
- var fire;
- var oldLegState;
- var d = 999985;
- var c = 0;
- var c2 = 0;
- var fc = 0;
- var shotID = 0;
- var xA = 0;
- var yA = 0;
- var f2 = "";
- var facing = "R";
- var hc = 0;
- var legState = "still";
- var inv = false;
- var shieldOn = false;
- var control = true;
- var exit = false;
- var life = 0;
- var gesture = false;
- var sl = "top";
- var ofc = 0;
- var endFire = false;
- var hover = true;
- function Bro2(px, py)
- {
- this.tX = this.x = px;
- this.tY = this.y = py;
- this.clip = _root.attachMovie("bro2","bro2Clip",this.d);
- this.w = this.clip._width;
- this.h = this.clip._height;
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.weapon = _root.bro2Weapon;
- this.trans = new flash.geom.Transform(this.clip);
- this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
- this.colorVars = new Object();
- _root.rapidVar = 2;
- this[this.weapon]();
- var _loc3_ = _root.bro2ShipLevel <= 3 ? _root.bro2ShipLevel : _root.bro2ShipLevel - 3;
- this.baseSpeed = this.speed = 6 + _loc3_;
- }
- function colorFlash(r, g, b, cMax)
- {
- this.colorVars.c = 0;
- this.colorVars.r = r;
- this.colorVars.g = g;
- this.colorVars.b = b;
- this.colorVars.cMax = cMax;
- this.colorVars.flashing = true;
- }
- function wave()
- {
- this.clip.gotoAndPlay("wave" + this.facing);
- this.fireDir = "";
- this.gesture = true;
- }
- function hit()
- {
- if(this.c2 > 60 && this.f2 != "dying")
- {
- if(this.shieldOn && !this.inv)
- {
- _root.shield.hit();
- }
- else if(!this.inv)
- {
- this.xA = this.yA = 0;
- this.control = false;
- this.facing = "death";
- this.fireDir = "";
- this.f2 = "dying";
- this.dc = 0;
- _root.rescue = false;
- _root.audio.playLevel2("broDeath",25);
- }
- }
- }
- function dying()
- {
- this.dc = this.dc + 1;
- this.colorTrans.redMultiplier = 0;
- this.colorTrans.greenMultiplier = 0;
- this.colorTrans.blueMultiplier = 0;
- this.colorTrans.redOffset = 0;
- this.colorTrans.greenOffset = 0;
- this.colorTrans.blueOffset = 0;
- var _loc3_ = random(4);
- if(_loc3_ == 0)
- {
- this.colorTrans.redOffset = 255;
- this.colorTrans.redMultiplier = 1;
- }
- else if(_loc3_ == 1)
- {
- this.colorTrans.greenOffset = 255;
- this.colorTrans.greenMultiplier = 1;
- }
- else if(_loc3_ == 2)
- {
- this.colorTrans.blueOffset = 255;
- this.colorTrans.blueMultiplier = 1;
- }
- else
- {
- this.colorTrans.redOffset = 255;
- this.colorTrans.greenOffset = 255;
- this.colorTrans.blueOffset = 255;
- }
- this.trans.colorTransform = this.colorTrans;
- this.clip._alpha = 100 - this.dc * 1.6;
- if(this.dc == 60)
- {
- if(_root.char2 == "broShip1")
- {
- var _loc4_ = _root["advanceDir" + _root.level] != "L" ? 1010 : -45;
- if(_root.broShip1.bg)
- {
- _root.bgWait = new classes.misc.BGWait(_loc4_,"bro1",false);
- _root.addFX("bgWait");
- }
- else if(!_root.broShip1.tagTeaming)
- {
- _root.broShip1 = new classes.bro.BroShip1(_loc4_,280);
- _root.addChar("broShip1");
- _root.broShip1.appear();
- _root.char = "broShip1";
- _root.char2 = "dead";
- }
- else
- {
- _root.broShip1.tagTeaming = false;
- _root.broShip1.giveControl();
- _root.char = "broShip1";
- _root.char2 = "dead";
- }
- _root.rescue = false;
- _root.createPowerUp([this.x,this.y,this.weapon]);
- _root.createPowerUp([this.x,this.y,"lifeMax"]);
- }
- else if(_root.char2 == "bro1")
- {
- _loc4_ = _root["advanceDir" + _root.level] != "L" ? 1010 : -45;
- _root.bro1 = new classes.bro.Bro1(_loc4_,280);
- _root.addChar("bro1");
- _root.bro1.appear();
- _root.char = "bro1";
- _root.char2 = "dead";
- _root.createPowerUp([this.x,this.y,this.weapon]);
- _root.shield = new classes.misc.Shield();
- _root.addPowerUp("shield");
- _root[_root.char].shieldOn = true;
- }
- else
- {
- _root.gameOver();
- }
- _root.removeChar("bro2");
- }
- }
- function nudge(pxA, pyA, pscale)
- {
- if((this.c == 0 || this.c > 5) && !this.inv && this.f2 != "dying")
- {
- this.c = 0;
- var _loc2_ = pscale / 100;
- this.xA = pxA * _loc2_;
- this.yA = pyA * _loc2_;
- this.f2 = "nudging";
- }
- }
- function nudging()
- {
- this.xA *= 0.75;
- this.yA *= 0.75;
- this.c = this.c + 1;
- if(this.c == 20)
- {
- this.xA = this.yA = 0;
- this.f2 = "";
- this.c = 0;
- }
- }
- function powerUp(type)
- {
- if(type.substr(0,10) == "speedBoost")
- {
- var _loc3_ = Number(type.substr(10));
- this.speedBoost(_loc3_ * 300);
- }
- else if(type.substr(0,11) == "weaponBoost")
- {
- _loc3_ = Number(type.substr(11));
- this.weaponBoost(_loc3_ * 200);
- }
- else
- {
- this[type]();
- }
- }
- function coin1()
- {
- _root.coins.addTo(1);
- this.colorFlash(200,200,200,10);
- }
- function coin5()
- {
- _root.coins.addTo(5);
- this.colorFlash(200,200,200,10);
- }
- function coin10()
- {
- _root.coins.addTo(10);
- this.colorFlash(200,200,0,10);
- }
- function coin25()
- {
- _root.coins.addTo(25);
- this.colorFlash(200,200,0,10);
- }
- function stealCoins(num)
- {
- if(!this.shieldOn && !this.inv)
- {
- _root.audio.playLevel2("coinDrain2",25);
- var _loc4_ = random(num) + 2;
- if(_root.coins.num - _loc4_ < 0)
- {
- _loc4_ = _root.coins.num;
- }
- _root.coins.addTo(-1 * _loc4_);
- var _loc3_ = 0;
- while(_loc3_ < _loc4_)
- {
- _root.fxID = _root.fxID + 1;
- _root["coinDrain" + _root.fxID] = new classes.fx.CoinDrain(this.x + 6,this.y + 6,_root.fxID);
- _root.addFX("coinDrain" + _root.fxID);
- _loc3_ = _loc3_ + 1;
- }
- }
- }
- function gem1()
- {
- _root.gems.addTo(1);
- this.colorFlash(40,255,180,15);
- }
- function gem2()
- {
- _root.gems.addTo(1);
- this.colorFlash(0,90,200,15);
- }
- function gem3()
- {
- _root.gems.addTo(1);
- this.colorFlash(255,50,0,15);
- }
- function gem4()
- {
- _root.gems.addTo(1);
- this.colorFlash(255,170,30,15);
- }
- function gem5()
- {
- _root.gems.addTo(1);
- this.colorFlash(255,100,255,15);
- }
- function gem6()
- {
- _root.gems.addTo(1);
- this.colorFlash(0,255,180,15);
- }
- function smartBomb()
- {
- _root.smartBomb.gotoAndPlay(2);
- var _loc2_ = 1;
- var _loc3_ = _root.chars.length;
- while(_loc2_ < _loc3_)
- {
- _root[_root.chars[_loc2_]].bombed(20);
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- _loc3_ = _root.enemyShots.length;
- var _loc4_ = _root.enemyShots.slice();
- while(_loc2_ < _loc3_)
- {
- _root[_loc4_[_loc2_]].bombed();
- _loc2_ = _loc2_ + 1;
- }
- _loc2_ = 0;
- _loc3_ = _root.FX.length;
- _loc4_ = _root.FX.slice();
- while(_loc2_ < _loc3_)
- {
- _root[_loc4_[_loc2_]].bombed();
- _loc2_ = _loc2_ + 1;
- }
- }
- function superP()
- {
- this.weaponBoost(600);
- this.speedBoost(600);
- this.shield();
- }
- function shield()
- {
- if(!this.shieldOn)
- {
- _root.shield = new classes.misc.Shield();
- _root.addPowerUp("shield");
- this.shieldOn = true;
- }
- else if(_root.shield.out)
- {
- _root.shield.renew();
- }
- this.colorFlash(70,180,250,30);
- }
- function rampage()
- {
- var _loc2_ = 0;
- var _loc3_ = _root.powerUps.length;
- while(_loc2_ < _loc3_)
- {
- if(_root.powerUps[_loc2_] == "rampage")
- {
- _root.removePowerUp("rampage");
- break;
- }
- _loc2_ = _loc2_ + 1;
- }
- _root.rampage = new classes.misc.Rampage(300);
- _root.addPowerUp("rampage");
- }
- function weaponBoost(num)
- {
- if(this.weapon == "laserA" || this.weapon == "doubleLaserA" || this.weapon == "tripleLaserA" || this.weapon == "bigLaser" || this.weapon == "twistLaser" || this.weapon == "tripleTwistLaser")
- {
- if(_root.currentBoost == "rapidFire")
- {
- _root.removePowerUp("rapidFire");
- }
- _root.currentBoost = "rapidFire";
- this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
- if(this.weapon != "bigLaser")
- {
- _root.rapidFire = new classes.misc.RapidFire(num,false);
- }
- else
- {
- _root.rapidFire = new classes.misc.RapidFire(num,true);
- }
- _root.addPowerUp("rapidFire");
- }
- if(this.weapon == "rapidLaser" || this.weapon == "doubleRapidLaser")
- {
- if(_root.currentBoost == "laserBoost")
- {
- _root.removePowerUp("laserBoost");
- }
- _root.currentBoost = "laserBoost";
- this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
- _root.laserBoost = new classes.misc.LaserBoost(num);
- _root.addPowerUp("laserBoost");
- }
- if(this.weapon == "superLaser")
- {
- if(_root.currentBoost == "superRapidFire")
- {
- _root.removePowerUp("superRapidFire");
- }
- _root.currentBoost = "superRapidFire";
- this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
- _root.superRapidFire = new classes.misc.SuperRapidFire(num);
- _root.addPowerUp("superRapidFire");
- }
- this.colorFlash(255,125,0,30);
- }
- function checkBoost()
- {
- if(_root.currentBoost != "")
- {
- _root.removePowerUp(_root.currentBoost);
- _root.currentBoost = "";
- _root.laserPower = 8;
- }
- }
- function laserA()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 11;
- this.fireFreqOrig = 11;
- this.clip.gun.gotoAndStop(this.weapon);
- }
- function doubleLaserA()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 11;
- this.fireFreqOrig = 11;
- _root.bro2Weapon = this.weapon = "doubleLaserA";
- this.clip.gun.gotoAndStop(this.weapon);
- this.colorFlash(200,200,0,30);
- }
- function tripleLaserA()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 11;
- this.fireFreqOrig = 11;
- _root.bro2Weapon = this.weapon = "tripleLaserA";
- this.clip.gun.gotoAndStop(this.weapon);
- this.colorFlash(255,160,0,30);
- }
- function twistLaser()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 10;
- this.fireFreqOrig = 10;
- _root.bro2Weapon = this.weapon = "twistLaser";
- this.colorFlash(100,200,230,30);
- }
- function tripleTwistLaser()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 10;
- this.fireFreqOrig = 10;
- _root.bro2Weapon = this.weapon = "tripleTwistLaser";
- this.colorFlash(100,200,230,30);
- }
- function rapidLaser()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 4;
- this.fireFreqOrig = 4;
- _root.bro2Weapon = this.weapon = "rapidLaser";
- this.clip.gun.gotoAndStop(this.weapon);
- this.colorFlash(0,230,190,30);
- }
- function bigLaser()
- {
- this.checkBoost();
- _root.rapidVar = 4;
- this.fireFreq = 9;
- this.fireFreqOrig = 9;
- _root.bro2Weapon = this.weapon = "bigLaser";
- this.clip.gun.gotoAndStop(this.weapon);
- this.colorFlash(0,130,255,30);
- }
- function superLaser()
- {
- this.checkBoost();
- _root.rapidVar = 2;
- this.fireFreq = 5;
- this.fireFreqOrig = 5;
- _root.bro2Weapon = this.weapon = "superLaser";
- this.colorFlash(255,255,255,30);
- }
- function speedBoost(num)
- {
- var _loc3_ = 0;
- var _loc4_ = _root.powerUps.length;
- while(_loc3_ < _loc4_)
- {
- if(_root.powerUps[_loc3_] == "speedBoost")
- {
- _root.removePowerUp("speedBoost");
- break;
- }
- _loc3_ = _loc3_ + 1;
- }
- _root.speedBoost = new classes.misc.SpeedBoost(num);
- _root.addPowerUp("speedBoost");
- this.colorFlash(0,255,0,60);
- }
- function fire_laserA()
- {
- _root.audio.playLevel5("laserA" + (random(5) + 1),random(4) + 6);
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_twistLaser()
- {
- _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
- this.shotID = this.shotID + 1;
- _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
- _root.addBroShot("twistLaser" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
- _root.addBroShot("twistLaser" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_tripleTwistLaser()
- {
- _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
- this.shotID = this.shotID + 1;
- _root["twistLaserB" + this.shotID] = new classes.bro.TwistLaserB(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("twistLaserB" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
- _root.addBroShot("twistLaserC" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
- _root.addBroShot("twistLaserC" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_doubleLaserA()
- {
- _root.audio.playLevel5("doubleLaserA" + (random(5) + 1),random(10) + 8);
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc6_ = 0;
- var _loc4_ = -3;
- var _loc5_ = 0;
- var _loc3_ = 9;
- }
- else
- {
- _loc6_ = -6;
- _loc4_ = 0;
- _loc5_ = 6;
- _loc3_ = 0;
- }
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- this.clip.gun.blast2.gotoAndPlay("go");
- }
- function fire_tripleLaserA()
- {
- _root.audio.playLevel5("tripleLaserA" + (random(5) + 1),random(10) + 8);
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc6_ = 0;
- var _loc4_ = -3;
- var _loc5_ = 0;
- var _loc3_ = 3;
- }
- else
- {
- _loc6_ = -3;
- _loc4_ = 0;
- _loc5_ = 3;
- _loc3_ = 0;
- }
- this.shotID = this.shotID + 1;
- _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,1,this.shotID);
- _root.addBroShot("spreadLaserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("laserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,2,this.shotID);
- _root.addBroShot("spreadLaserA" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- this.clip.gun.blast2.gotoAndPlay("go");
- }
- function fire_rapidLaser()
- {
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc6_ = 0;
- var _loc4_ = -6;
- var _loc5_ = 0;
- var _loc3_ = 6;
- }
- else
- {
- _loc6_ = -6;
- _loc4_ = 0;
- _loc5_ = 6;
- _loc3_ = 0;
- }
- _root.audio.playLevel5("rapidLaser" + (random(5) + 1),random(30) + 10);
- this.shotID = this.shotID + 1;
- _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
- _root.addBroShot("rapidLaser" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
- _root.addBroShot("rapidLaser" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go");
- }
- function fire_bigLaser()
- {
- _root.audio.playLevel5("bigLaser" + (random(3) + 1),random(10) + 8);
- this.shotID = this.shotID + 1;
- _root["bigLaser" + this.shotID] = new classes.bro.BigLaser(this.shotX,this.shotY,this.fireDir,this.shotID);
- _root.addBroShot("bigLaser" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go2");
- if(this.fireDir == "U")
- {
- this.nudge(0,4,100);
- }
- else if(this.fireDir == "D")
- {
- this.nudge(0,-4,100);
- }
- else if(this.fireDir == "L")
- {
- this.nudge(4,0,100);
- }
- else
- {
- this.nudge(-4,0,100);
- }
- }
- function fire_superLaser()
- {
- _root.audio.playLevel5("superLaser" + (random(3) + 1),random(10) + 8);
- if(this.sl == "top")
- {
- this.sl = "bot";
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- var _loc4_ = 0;
- var _loc3_ = 6;
- }
- else
- {
- _loc4_ = 6;
- _loc3_ = 0;
- }
- }
- else
- {
- this.sl = "top";
- if(this.fireDir == "R" || this.fireDir == "L")
- {
- _loc4_ = 0;
- _loc3_ = -6;
- }
- else
- {
- _loc4_ = -6;
- _loc3_ = 0;
- }
- }
- this.shotID = this.shotID + 1;
- _root["superLaserA" + this.shotID] = new classes.bro.SuperLaserA(this.shotX + _loc4_,this.shotY + _loc3_,this.fireDir,this.shotID);
- _root.addBroShot("superLaserA" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
- _root.addBroShot("superLaserB" + this.shotID);
- this.shotID = this.shotID + 1;
- _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
- _root.addBroShot("superLaserB" + this.shotID);
- this.clip.gun.blast.gotoAndPlay("go2");
- if(this.fireDir == "U")
- {
- this.nudge(0,4,100);
- }
- else if(this.fireDir == "D")
- {
- this.nudge(0,-4,100);
- }
- else if(this.fireDir == "L")
- {
- this.nudge(4,0,100);
- }
- else
- {
- this.nudge(-4,0,100);
- }
- }
- function action11()
- {
- this.speed = 9;
- this.control = false;
- this.exit = true;
- this.facing = "R";
- this.fireDir = "";
- this.gotoXY(1300,0);
- }
- function positionForSwitch(pdestY)
- {
- this.control = false;
- this.gotoXY(0,pdestY,"action6B");
- this.fireDir = "";
- this.facing = "R";
- }
- function action6B()
- {
- this.gotoXY(_root.newShipClip._x + 9,0);
- }
- function getInShip(pdestY)
- {
- this.gotoXY(0,pdestY);
- }
- function getInOldShipA()
- {
- this.exit = true;
- this.control = false;
- this.fireDir = "";
- this.facing = "R";
- this.gotoXY(_root.newShipClip._x - 94,0,"getInOldShipB");
- }
- function getInOldShipB()
- {
- this.gotoXY(0,_root.newShipClip._y + 3,"getInOldShipC");
- }
- function getInOldShipC()
- {
- _root.bro2ShipLevel = _root.tempShipLevel;
- _root.bro2ShipVar = _root.tempShipVar;
- delete _root.tempShipLevel;
- delete _root.tempShipVar;
- _root.bro2Life = _root.tempLife;
- delete _root.tempLife;
- _root.broShip2 = new classes.bro.BroShip2(_root.newShipClip._x,_root.newShipClip._y);
- _root.addChar("broShip2");
- _root.char2 = "broShip2";
- _root.newShipClip.removeMovieClip();
- _root.broShip2.control = false;
- _root.broShip2.facing = "R";
- _root.broShip2.fireDir = "";
- _root.broShip2.clip.body.getOut = true;
- _root.broShip2.clip.body.gotoAndPlay("close");
- _root.removeChar("bro2");
- }
- function endSeq(pdir)
- {
- this.speed = this.baseSpeed = 7;
- this.exit = true;
- this.weapon = "rapidLaser";
- _root.bro2weapon = this.weapon;
- this[this.weapon]();
- this.facing = this.fireDir = pdir;
- this.control = false;
- var _loc3_ = this.facing != "L" ? 200 : 800;
- this.gotoXY(_loc3_,280);
- }
- function endSeqB()
- {
- this.gotoXY(0,_root.deathHeadClip._y);
- }
- function endSeqMove()
- {
- this.speed = this.baseSpeed = 9;
- this.endFire = true;
- this.gotoXY(_root.randRange(100,900),_root.randRange(100,500),"endSeqMove");
- }
- function endStill()
- {
- this.endFire = false;
- this.dirX = this.dirY = this.fireDir = "";
- this.f2 = "";
- }
- function endPos()
- {
- this.xA = this.yA = 0;
- this.speed = 2;
- this.control = false;
- this.facing = "L";
- this.fireDir = "";
- this.gotoXY(357,250);
- }
- function endPos2()
- {
- this.xA = this.yA = 0;
- this.clip._x = this.x = this.tX = 357;
- this.gotoXY(0,471,"endPos3");
- }
- function endPos3()
- {
- this.xA = this.yA = this.speed = 0;
- this.hover = false;
- _root.endBGClip.clip.buzzPack._visible = true;
- _root.endBGClip.clip.buzzPack.play();
- _root.removeChar("bro2");
- }
- function appear()
- {
- this.exit = true;
- this.inv = true;
- this.control = false;
- if(this.x < 0)
- {
- this.facing = "R";
- this.fireDir = "R";
- this.gotoXY(150,0,"giveControl");
- }
- else
- {
- this.facing = "L";
- this.fireDir = "L";
- this.gotoXY(850,0,"giveControl");
- }
- }
- function giveControl()
- {
- this.inv = false;
- this.control = true;
- this.exit = false;
- }
- function gotoXY(pdestX, pdestY, pmetFunction, pwave)
- {
- this.destX = pdestX;
- this.destY = pdestY;
- this.xyMetFunction = pmetFunction;
- var _loc2_ = pwave;
- if(this.destX != 0)
- {
- this.dirX = this.x <= this.destX ? "R" : "L";
- }
- if(this.destY != 0)
- {
- this.dirY = this.y <= this.destY ? "D" : "U";
- }
- this.f2 = "goingXY";
- if(_loc2_)
- {
- this.wave();
- }
- }
- function goingXY()
- {
- if(this.destX != 0 && Math.abs(this.x - this.destX) < this.speed + 1)
- {
- this.dirX = "";
- var _loc2_ = true;
- }
- if(this.destX == 0)
- {
- _loc2_ = true;
- }
- if(this.destY != 0 && Math.abs(this.y - this.destY) < this.speed + 1)
- {
- this.dirY = "";
- var _loc3_ = true;
- }
- if(this.destY == 0)
- {
- _loc3_ = true;
- }
- if(_loc2_ && _loc3_)
- {
- this[this.xyMetFunction]();
- }
- }
- function changeDir()
- {
- this.dirX = this.dirXArray[random(this.dirXArray.length)];
- this.dirY = this.dirYArray[random(this.dirYArray.length)];
- }
- function wander()
- {
- if(random(100) > 93)
- {
- this.changeDir();
- }
- }
- function main()
- {
- this.c2 = this.c2 + 1;
- this[this.f2]();
- if(this.endFire)
- {
- if(random(30) == 0)
- {
- var _loc4_ = ["L","R","D","U","","","",""];
- this.fireDir = _loc4_[random(8)];
- }
- if(random(60) == 0)
- {
- this.dirX = this.dirY = "";
- this.f2 = "";
- }
- else if(random(45) == 0)
- {
- this.endSeqMove();
- }
- }
- if(this.control)
- {
- this.legState = "still";
- if(Key.isDown(_root.moveU))
- {
- this.tY = this.y - this.speed;
- this.legState = "U";
- }
- if(Key.isDown(_root.moveD))
- {
- this.tY = this.y + this.speed;
- this.legState = "D";
- }
- if(Key.isDown(_root.moveL))
- {
- this.tX = this.x - this.speed;
- this.legState = this.facing != "L" ? "B" : "F";
- }
- if(Key.isDown(_root.moveR))
- {
- this.tX = this.x + this.speed;
- this.legState = this.facing != "R" ? "B" : "F";
- }
- if(Key.isDown(_root.fireU))
- {
- this.fire = true;
- this.shotY = this.y - 3;
- this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
- this.fireDir = "U";
- }
- else if(Key.isDown(_root.fireD))
- {
- this.fire = true;
- this.shotY = this.y + 39;
- this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
- this.fireDir = "D";
- }
- else if(Key.isDown(_root.fireL))
- {
- this.fire = true;
- this.shotX = this.x - 9;
- this.shotY = this.y + 21;
- this.fireDir = this.facing = "L";
- }
- else if(Key.isDown(_root.fireR))
- {
- this.fire = true;
- this.shotX = this.x + 30;
- this.shotY = this.y + 21;
- this.fireDir = this.facing = "R";
- }
- else
- {
- this.fire = false;
- this.fireDir = this.facing != "R" ? "L" : "R";
- this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
- this.fc = this.fc + 1;
- }
- if(this.oldLegState != this.legState)
- {
- this.clip.legs.gotoAndStop(this.legState);
- this.clip.flame.gotoAndPlay(this.legState);
- }
- this.oldLegState = this.legState;
- }
- else
- {
- this.legState = "still";
- if(this.dirY == "U")
- {
- this.tY = this.y - this.speed;
- this.legState = "U";
- }
- if(this.dirY == "D")
- {
- this.tY = this.y + this.speed;
- this.legState = "D";
- }
- if(this.dirX == "L")
- {
- this.tX = this.x - this.speed;
- this.legState = this.facing != "L" ? "B" : "F";
- }
- if(this.dirX == "R")
- {
- this.tX = this.x + this.speed;
- this.legState = this.facing != "R" ? "B" : "F";
- }
- if(this.fireDir == "U")
- {
- this.fire = true;
- this.shotY = this.y - 3;
- this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
- this.fireDir = "U";
- }
- else if(this.fireDir == "D")
- {
- this.fire = true;
- this.shotY = this.y + 39;
- this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
- this.fireDir = "D";
- }
- else if(this.fireDir == "L")
- {
- this.fire = true;
- this.shotX = this.x - 9;
- this.shotY = this.y + 21;
- this.fireDir = this.facing = "L";
- }
- else if(this.fireDir == "R")
- {
- this.fire = true;
- this.shotX = this.x + 30;
- this.shotY = this.y + 21;
- this.fireDir = this.facing = "R";
- }
- else
- {
- this.fire = false;
- var _loc3_ = this.facing != "R" ? "L" : "R";
- if(this.facing != "death" && !this.gesture)
- {
- this.clip.gotoAndStop("face" + this.facing + "fire" + _loc3_);
- }
- this.fc = this.fc + 1;
- }
- if(this.oldLegState != this.legState)
- {
- this.clip.legs.gotoAndStop(this.legState);
- this.clip.flame.gotoAndPlay(this.legState);
- }
- this.oldLegState = this.legState;
- }
- if(this.colorVars.flashing)
- {
- this.colorVars.c = this.colorVars.c + 1;
- this.colorTrans.redOffset = this.colorVars.r - this.colorVars.c * (this.colorVars.r / this.colorVars.cMax);
- this.colorTrans.greenOffset = this.colorVars.g - this.colorVars.c * (this.colorVars.g / this.colorVars.cMax);
- this.colorTrans.blueOffset = this.colorVars.b - this.colorVars.c * (this.colorVars.b / this.colorVars.cMax);
- if(this.colorVars.c >= this.colorVars.cMax)
- {
- this.colorVars.flashing = false;
- this.colorTrans.redOffset = 0;
- this.colorTrans.greenOffset = 0;
- this.colorTrans.blueOffset = 0;
- }
- this.trans.colorTransform = this.colorTrans;
- }
- if(!this.exit)
- {
- if(this.tX < 35)
- {
- this.tX = 35;
- }
- if(this.tX > 965 - this.w)
- {
- this.tX = 965 - this.w;
- }
- if(this.tY < 35)
- {
- this.tY = 35;
- }
- if(this.tY > 565 - this.h)
- {
- this.tY = 565 - this.h;
- }
- }
- else if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
- {
- _root.removeChar("bro2");
- }
- if(this.fire)
- {
- this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
- if(this.fc <= this.ofc)
- {
- this.fc = this.ofc + 1;
- }
- else
- {
- this.fc = this.fc + 1;
- }
- if(this.fc > this.fireFreq)
- {
- this.fc = 0;
- this["fire_" + this.weapon]();
- }
- this.ofc = this.fc;
- }
- this.tX += this.xA;
- this.tY = !this.hover ? this.tY + this.yA : this.tY + this.yA + 0.5 * Math.sin(this.hc += 0.1);
- this.x = this.tX;
- this.y = this.tY;
- this.clip._x = this.x;
- this.clip._y = this.y;
- }
- }
-